
import 'package:wallet_utils/log_util.dart';
import 'package:wallet_utils/text_util.dart';
import 'package:url_launcher/url_launcher.dart';

/// @author: pengboboer
/// @createDate: 2021/11/19
class LaunchUtils {
  static toPhone(String? phone) async{
    if (TextUtil.isEmpty(phone)) throw 'phone could not null';

    String url = 'tel:$phone';
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }
  static launchUrl(String url) async{
    if (await canLaunch(url)) {
       await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }
}